/**
 * author: Hanflyee  flyee1980@163.com
 * vision: v1.0
 * data: 2009-7-9
 */
package com.flyee.model{
	import com.flyee.service.pool.ObjectCollection;
	import com.flyee.utils.Constants;
	
	import flash.utils.Dictionary;
	
	/**
	 * 人物数据模型, 继承抽象对象，保证生成客户端model id
	 */
	public class Charactor extends AbstractObject{
		
		public var name : String;
		public var gcode : String;
		public var id : String;
		public var lvl : int = 1;
		public var exp : Number = 1; 
		public var nextExp : Number = lvl * Constants.LEVEL_UP_EXP;
		public var hp : int = 500;
		public var mp : int = 500;
		public var x : Number = 0;
		public var y : Number = 0;
		public var mySex : int;
		public var sceneId : String;
		public var sceneInstanceId : String;
		public var depth : int;
		/**方向0~7*/
		public var direction : int;
		/**动作状态：1站，2走*/
		public var action : int = 1;
		/**目标人物*/
		public var target : Charactor;
		/**施法状态*/
		public var skillStatus : Boolean = false;
		/**移动状态*/
		public var moveStatus : Boolean = false;
		/**等待移动指令状态*/
		public var waitMoveStatus : Boolean = false;
		/**技能公共冷却*/
		public var cooldown : Boolean = true;
		
		[Bindable]
		public var equipList:Dictionary = new Dictionary();
		
		public var equipID:String = ObjectCollection.DEFAULT_USER_ID;
		
		private var buffDictionary:Dictionary = null;
		public function Charactor(){
			super();			
			buffDictionary = new Dictionary();
		}
		
		public function isBuff(type:String):Boolean{
			for(var i:String in buffDictionary){
				if(i == type){
					return true;
				}
			}
			return false;
		}
		
		public function addBuff(type:String,viewerId:String):void{
			buffDictionary[type] = viewerId;
		}
		
		public function getBuffByType(type:String):String{
			return buffDictionary[type];
		}
		
		public function removeBuff(type:String):void{
			if(buffDictionary[type]){
				buffDictionary[type] = null;
				delete buffDictionary[type];
			}
		}

	}
	
}